<form class='form-horizontal'  th:action="@{/resource/add.gsp}" id="addForm" role="form"  action="#" method="post">
<input th:value="${parentId}" name="parentId" type="hidden" />
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">新增资源信息</h4>
    </div>
    <div class="modal-body">
        <div class="row">
            <div class="col-xs-12">
                <div class="control-group">
                    <label class="control-label"> 资源类型： </label>
                    <div class="controls">
                        <select class="form-control" name="type">
                            <option value="1">菜单</option>
                            <option value="2">按钮</option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label"  for='resourceName'> 资源名称： </label>
                    <div class="controls">
                        <input name="resourceName" placeholder="请输资源名称" data-rule-minlength='2' data-rule-required='true'  type="text" class="form-control" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label"> 资源标志： </label>
                    <div class="controls">
                        <input name="permission" placeholder="请输资源标志" type="text" class="form-control" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">资源URI：</label>
                    <div class="controls">
                        <input name="permValue" placeholder="请输资源URI" data-rule-minlength='2' data-rule-required='true'  type="text" class="form-control" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">资源代码：</label>
                    <div class="controls">
                        <input name="codeNum" placeholder="请输资源代码" data-rule-minlength='2' data-rule-required='true'  type="text" class="form-control" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">icon名称：</label>
                    <div class="controls">
                        <input name="iconCls" placeholder="请输icon名称" type="text" class="form-control" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label"> 排序： </label>
                    <div class="controls">
                        <input class="form-control" value="0" placeholder="请输入排序" type="text" name="sortOrder" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">资源简介：</label>
                    <div class="controls">
                        <textarea class="form-control" placeholder="最多输入140字" name="description"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit">
            <strong>提 交</strong>
        </button>
        <button type="button" class="btn btn-default" data-dismiss="modal">
            <strong>关 闭</strong>
        </button>
    </div>
</form>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function() {
        var rules = {
            resourceName : {
                required : true,
                maxlength : 20
            },
            permission : {
                required : true,
                maxlength : 50
            },
            permValue : {
                maxlength : 100
            },
            code : {
                maxlength : 80
            },
            iconCls : {
                maxlength : 30
            },
            sortOrder : {
                required : true,
                max : 99
            },
            description : {
                maxlength : 140
            }
        }
        var messages = {

        }
        tg_baseFormAjaxSubmit("addForm", rules, messages, function() {
            location.href = /*[[@{/resource/list.gsp}]]*/'';
        });
    });
    /*]]>*/
</script>